﻿<UserControl
    x:Class="PrintingAndScanningExample.PictureModelLayout"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:PrintingAndScanningExample"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300"
    d:DesignWidth="400"
    d:DataContext="{d:DesignInstance Type=local:DesignPictureModel, IsDesignTimeCreatable=True}">
    <UserControl.Resources>
        <local:BooleanToVisibilityConverter x:Key="IfTrueThenVisible" VisibleValue="True"/>
        <local:BooleanToVisibilityConverter x:Key="IfFalseThenVisible" VisibleValue="False"/>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Image Grid.Row="0" Source="{Binding PictureModel.Thumbnail}" Visibility="{Binding UseThumbnail, Converter={StaticResource IfTrueThenVisible}}"/>
        <Image Grid.Row="0" Source="{Binding PictureModel.Picture}" Visibility="{Binding UseThumbnail, Converter={StaticResource IfFalseThenVisible}}"/>
        <TextBlock Grid.Row="1" Text="{Binding PictureModel.Caption}" HorizontalAlignment="Center"/>
    </Grid>
</UserControl>
